package com.zl.tby.vo;

import com.zl.tby.model.TbyWorkDynamics;
import lombok.Data;
import org.noear.solon.validation.annotation.Length;
import org.noear.solon.validation.annotation.NotBlank;
import org.noear.solon.validation.annotation.NotNull;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * 工作动态表单bean
 * @author sunjiaxing
 * @version 1.0
 * @since 2024/8/22 00:28
 */
@Data
public class TbyWorkDynamicsForm {

    /**主键id*/
    private Long id;
    /**标题*/
    @NotBlank(message = "标题不能为空")
    @Length(max = 20, message = "标题最大长度为20")
    private String title;
    /**类型*/
    @NotNull(message = "类型不能为空")
    private Integer type;
    /**图片*/
    @NotNull(message = "类型不能为空")
    private String icon;
    /**经度*/
    @NotBlank(message = "经度不能为空")
    @Length(max = 32, message = "经度最大长度为32")
    private String longitude;
    /**纬度*/
    @NotBlank(message = "纬度不能为空")
    @Length(max = 32, message = "纬度最大长度为32")
    private String latitude;
    /**介绍*/
    private String content;
    private LocalDateTime createTime;

    public TbyWorkDynamics createEntity() {
        TbyWorkDynamics entity = new TbyWorkDynamics();
        entity.setType(this.getType());
        entity.setTitle(this.getTitle());
        entity.setLongitude(this.getLongitude());
        entity.setLatitude(this.getLatitude());
        entity.setIcon(this.getIcon());
        entity.setContent(this.getContent());
        entity.setCreateTime(this.getCreateTime());
        return entity;
    }

    public void updateEntity(TbyWorkDynamics entity) {
        entity.setType(this.getType());
        entity.setTitle(this.getTitle());
        entity.setLongitude(this.getLongitude());
        entity.setLatitude(this.getLatitude());
        entity.setIcon(this.getIcon());
        entity.setContent(this.getContent());
        entity.setCreateTime(this.getCreateTime());
    }

}
